using System;

namespace TodoSoft.Data.Migration
{
	[MigrationComponent("ea26852f-c421-47f8-8553-ae8c7dd2fd95", "'version' table")]
	public class VersionMigration : Migration
	{
		public static string VersionTableName = "version";
		public static string GetCurrentVersionProcedureName = "GetCurrentVersion";
		public static string UpdateVersionProcedureName = "UpdateVersion";
		
		[Changeset(0, "Create table 'version'")]
		public void Create()
		{
			//Create 'version' table
			//DataBase.ExecuteNonQuery ("CREATE TABLE \"version\" (versionid uuid, componentid uuid, versionnumber integer,   versionname character varying(32), componentname character varying(32), CONSTRAINT version_pk PRIMARY KEY (versionid)) ");
			DataBase.CreateTable (VersionTableName);
			//DataBase.AddBaseFields ("version");
			DataBase.AlterTableAddColumn(VersionTableName, "componentid", typeof(Guid));
			DataBase.AlterTableAddColumn(VersionTableName, "versionnumber", typeof(int));
			DataBase.AlterTableAddColumn(VersionTableName, "versionname", typeof(string), 64);
			DataBase.AlterTableAddColumn(VersionTableName, "componentname", typeof(string), 32);
		}
	}
}

